<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript">
    /*选择机构是表格的搜索功能*/
    function Org_search(url) {
        var jsonStr = {
            flg:2,
            name:$('#js_sel_name').val(),
            orgCode:$('#js_sel_code').val(),
            orgId:"",
            page:""
        }
        doList(jsonStr,url+toListUrl, $("#js_seller_org"));
    }
    /*选择机构功能*/
    function _select_org(orgId, orgName, orgCode) {
        $('#insert_orgName').val(orgName);
        $('#insert_orgId').val(orgId);
        $('#insert_orgCode').val(orgCode);
        $("#js_seller_org").dialog("close");
    }
</script>
<div id="js_seller_org">

    <div class="searchBar">
        <a class="selectCodeBtn searchPos select_small_back" onclick="Org_search('${base}/org')"></a>

        <div class="cnd2-4">
            <span class="label">机构名称</span>

            <div class="inputContainer">
                <input id="js_sel_name" class="inputStyles" data-options="validType:'length[0,32]'"/>
            </div>
        </div>

        <div class="cnd2-4">
            <span class="label">组织机构代码</span>

            <div class="inputContainer">
                <input id="js_sel_code" class="inputStyles"/>
            </div>
        </div>
    </div>

    <div>
        <table class="new_datagrid" id="org_dg" style="width:100%; height:auto;">
            <thead>
            <tr>
                <th width="10%">机构名称</th>
                <th width="10%">组织机构代码</th>

                <th width="5%"></th>
                <th width="10%"></th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="org" items="${obj.queryReturn.rows}" varStatus="index">
                <tr>
                    <td>${org.name}</td>
                    <td>${org.orgCode}</td>
                    <td>
                        <a class="new_btn new_btn_back ui-widget-content" onclick="_select_org(${org.id},'${org.name}','${org.orgCode}')">选择</a>
                    </td>
                    <td>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>

        <div class="fr">
            <a href="#" class="prev prevImg" onclick="prevPage($('#sel_org_page'),'${base}/org',3,$('#js_seller_org'),${obj.page},${obj.queryReturn.pageSum})"></a>
            <span class="prevSpan">PREV</span>
            <input id="sel_org_page" class="centerInput" value="${obj.page}"/>/<input id="sel_org_count_page"
                                                                                      readonly="readonly"
                                                                                      class="centerInput"
                                                                                      value="${obj.queryReturn.pageSum}"/>
            <a href="#" class="next nextImg" onclick="nextPage($('#sel_org_page'),'${base}/org',3,$('#js_seller_org'),${obj.page},${obj.queryReturn.pageSum})"></a>
            <span class="nextSpan">NEXT</span>
        </div>
    </div>

</div>
